﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XL.Crawler.Core
{
    /// <summary>
    /// 参数
    /// </summary>
    public partial class CrawlerParameter
    {
        /// <summary>
        /// 构造
        /// </summary>
        public CrawlerParameter()
        {

        }

        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="url">请求地址</param>
        /// <param name="httpMethod">请求方式</param>
        /// <param name="parameters">参数</param>
        /// <param name="headers">请求头</param>
        /// <param name="proxy">代理</param>
        /// <exception cref="ArgumentNullException"></exception>
        public CrawlerParameter(string url, string httpMethod, object? parameters, Dictionary<string, string>? headers, string? proxy)
        {
            Url = url ?? throw new ArgumentNullException(nameof(url));
            HttpMethod = httpMethod ?? throw new ArgumentNullException(nameof(httpMethod));
            Parameters = parameters;
            Headers = headers;
            Proxy = proxy;
        }

        /// <summary>
        /// 请求地址
        /// </summary>
        public string Url { get; set; } = null!;
        /// <summary>
        /// 请求方式
        /// </summary>
        public string HttpMethod { get; set; } = "Get";

        /// <summary>
        /// 参数
        /// </summary>
        public object? Parameters { get; set; } = null;

        /// <summary>
        /// 请求头
        /// </summary>
        public Dictionary<string, string>? Headers { get; set; }

        /// <summary>
        /// 代理
        /// </summary>
        public string? Proxy { get; set; }
    }
}
